<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>transition动画</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        main {
            width: 10rem;
            height: 10rem;
            background-color: cyan;
            position: relative;
        }

        /*main:hover {*/
        /*    transition: 2s;*/
        /*    !*transform: translateX(15rem);*!*/
        /*    transform: rotate(45deg);*/
        /*}*/
        nav{
            width: 100%;
            height: 100%;
            background-color: purple;
            position: absolute;
        }
        nav:hover{
            transform: translate(0, -100%);
            transition: 2s;
        }
        /*nav[class='active'] {*/
        /*    transform: translate(0, 0);*/
        /*}*/
        nav:nth-child(1){
            background-color: purple;
            float: left;
        }
        nav:nth-child(2){
            background-color: gray;
            float: left;
        }
        nav:nth-child(3){
            background-color: black;
            float: left;
        }
    </style>
</head>
<body>
<main>
    <nav></nav>
    <nav></nav>
    <nav class="active"></nav>
</main>
</body>
</html>
